﻿using System;
using System.Collections;
using System.Collections.Generic;
using Manager;
using UnityEngine;

// Token: 0x020002AD RID: 685
[Serializable]
public class CharMale : global::CharInfo
{
	// Token: 0x1700025D RID: 605
	// (get) Token: 0x060010D9 RID: 4313 RVA: 0x00079F80 File Offset: 0x00078180
	// (set) Token: 0x060010DA RID: 4314 RVA: 0x00079F88 File Offset: 0x00078188
	public global::CharMaleBody maleBody { get; set; }

	// Token: 0x1700025E RID: 606
	// (get) Token: 0x060010DB RID: 4315 RVA: 0x00079F94 File Offset: 0x00078194
	// (set) Token: 0x060010DC RID: 4316 RVA: 0x00079F9C File Offset: 0x0007819C
	public global::CharMaleCustom maleCustom { get; set; }

	// Token: 0x1700025F RID: 607
	// (get) Token: 0x060010DD RID: 4317 RVA: 0x00079FA8 File Offset: 0x000781A8
	// (set) Token: 0x060010DE RID: 4318 RVA: 0x00079FB0 File Offset: 0x000781B0
	public global::CharMaleClothes maleClothes { get; set; }

	// Token: 0x17000260 RID: 608
	// (get) Token: 0x060010DF RID: 4319 RVA: 0x00079FBC File Offset: 0x000781BC
	// (set) Token: 0x060010E0 RID: 4320 RVA: 0x00079FC4 File Offset: 0x000781C4
	public global::CharMaleFile maleFile { get; set; }

	// Token: 0x17000261 RID: 609
	// (get) Token: 0x060010E1 RID: 4321 RVA: 0x00079FD0 File Offset: 0x000781D0
	// (set) Token: 0x060010E2 RID: 4322 RVA: 0x00079FD8 File Offset: 0x000781D8
	public global::CharFileInfoCustomMale maleCustomInfo { get; set; }

	// Token: 0x17000262 RID: 610
	// (get) Token: 0x060010E3 RID: 4323 RVA: 0x00079FE4 File Offset: 0x000781E4
	// (set) Token: 0x060010E4 RID: 4324 RVA: 0x00079FEC File Offset: 0x000781EC
	public global::CharFileInfoClothesMale maleClothesInfo { get; set; }

	// Token: 0x17000263 RID: 611
	// (get) Token: 0x060010E5 RID: 4325 RVA: 0x00079FF8 File Offset: 0x000781F8
	// (set) Token: 0x060010E6 RID: 4326 RVA: 0x0007A000 File Offset: 0x00078200
	public global::CharFileInfoStatusMale maleStatusInfo { get; set; }

	// Token: 0x17000264 RID: 612
	// (get) Token: 0x060010E7 RID: 4327 RVA: 0x0007A00C File Offset: 0x0007820C
	// (set) Token: 0x060010E8 RID: 4328 RVA: 0x0007A014 File Offset: 0x00078214
	public global::CharFileInfoParameterMale maleParameterInfo { get; set; }

	// Token: 0x060010E9 RID: 4329 RVA: 0x0007A020 File Offset: 0x00078220
	public override bool Load(bool changeStatus = false)
	{
		return this.maleBody.Load(changeStatus);
	}

	// Token: 0x060010EA RID: 4330 RVA: 0x0007A030 File Offset: 0x00078230
	public override void Reload(bool noChangeClothes = false, bool noChangeHead = false, bool noChangeHair = false)
	{
		this.maleBody.Reload(noChangeClothes, noChangeHead, noChangeHair);
	}

	// Token: 0x060010EB RID: 4331 RVA: 0x0007A040 File Offset: 0x00078240
	public override IEnumerator LoadAsync(bool changeStatus = false)
	{
		yield return base.StartCoroutine(this.maleBody.LoadAsync(changeStatus, true));
		yield break;
	}

	// Token: 0x060010EC RID: 4332 RVA: 0x0007A06C File Offset: 0x0007826C
	public override bool InitializeExpression(bool enable = true)
	{
		return this.maleBody.InitializeExpression(enable);
	}

	// Token: 0x060010ED RID: 4333 RVA: 0x0007A07C File Offset: 0x0007827C
	public virtual void Initialize(GameObject _objRoot, int id, int no, global::CharMaleFile _chafile = null)
	{
		base.MemberInitialize();
		base.ListInfo = global::Singleton<Manager.Character>.Instance.charaListInfo;
		base.objRoot = _objRoot;
		base.CharID = id;
		base.LoadNo = no;
		base.Sex = 0;
		bool flag = _chafile != null && _chafile.customInfo.sex == 0;
		if (flag)
		{
			this.maleFile = _chafile;
			base.chaFile = _chafile;
		}
		else
		{
			global::CharMaleFile charMaleFile = new global::CharMaleFile();
			this.maleFile = charMaleFile;
			base.chaFile = charMaleFile;
		}
		global::CharFileInfoCustomMale maleCustomInfo = this.maleFile.maleCustomInfo;
		this.maleCustomInfo = maleCustomInfo;
		base.customInfo = maleCustomInfo;
		global::CharFileInfoClothesMale maleClothesInfo = this.maleFile.maleClothesInfo;
		this.maleClothesInfo = maleClothesInfo;
		base.clothesInfo = maleClothesInfo;
		global::CharFileInfoStatusMale maleStatusInfo = this.maleFile.maleStatusInfo;
		this.maleStatusInfo = maleStatusInfo;
		base.statusInfo = maleStatusInfo;
		global::CharFileInfoParameterMale maleParameterInfo = this.maleFile.maleParameterInfo;
		this.maleParameterInfo = maleParameterInfo;
		base.parameterInfo = maleParameterInfo;
		global::CharMaleBody charMaleBody = _objRoot.AddComponent<global::CharMaleBody>();
		this.maleBody = charMaleBody;
		base.chaBody = charMaleBody;
		if (base.chaBody)
		{
			this.maleBody.Initialize(this);
			global::CharMaleCustom maleCustom = this.maleBody.maleCustom;
			this.maleCustom = maleCustom;
			base.chaCustom = maleCustom;
			global::CharMaleClothes maleClothes = this.maleBody.maleClothes;
			this.maleClothes = maleClothes;
			base.chaClothes = maleClothes;
		}
		if (!flag)
		{
			this.LoadPresetInfo("ill_m_Honey_01", false);
		}
	}

	// Token: 0x060010EE RID: 4334 RVA: 0x0007A1F4 File Offset: 0x000783F4
	public virtual void LoadPresetInfo(string assetName, bool noSetPNG = false)
	{
		Dictionary<int, global::CharaSampleInfo> charaSampleInfoM = base.ListInfo.GetCharaSampleInfoM();
		foreach (KeyValuePair<int, global::CharaSampleInfo> keyValuePair in charaSampleInfoM)
		{
			if (keyValuePair.Value.fileName == assetName)
			{
				this.maleFile.charaFileName = assetName + ".png";
				this.maleFile.Load(keyValuePair.Value.abName, keyValuePair.Value.fileName, noSetPNG, true);
				break;
			}
		}
	}

	// Token: 0x060010EF RID: 4335 RVA: 0x0007A2A8 File Offset: 0x000784A8
	public override void ChangeMouthPtnSub(int ptn, bool blend)
	{
		if (ptn == 10)
		{
			base.ChangeTongueState(1);
		}
		else
		{
			base.ChangeTongueState(0);
		}
	}

	// Token: 0x060010F0 RID: 4336 RVA: 0x0007A2C8 File Offset: 0x000784C8
	public virtual bool LookAt(Transform _transLook, bool _bPositon)
	{
		GameObject referenceInfo = base.GetReferenceInfo(global::CharReference.RefObjKey.H_Kokan);
		GameObject referenceInfo2 = base.GetReferenceInfo(global::CharReference.RefObjKey.H_DanDir);
		if (referenceInfo == null)
		{
			return false;
		}
		if (_transLook == null)
		{
			return false;
		}
		referenceInfo.transform.LookAt(_transLook);
		if (_bPositon && referenceInfo2 != null)
		{
			referenceInfo2.transform.position = _transLook.position;
		}
		return true;
	}

	// Token: 0x060010F1 RID: 4337 RVA: 0x0007A334 File Offset: 0x00078534
	public virtual bool setLerpBackParam(float _fTime)
	{
		this.maleBody.sonRotDeltaTime = 0f;
		this.maleBody.sonRotTime = _fTime;
		return true;
	}

	// Token: 0x060010F2 RID: 4338 RVA: 0x0007A354 File Offset: 0x00078554
	public virtual bool LookAtLerpBack(Quaternion _qLook, float _fDelta)
	{
		GameObject referenceInfo = base.GetReferenceInfo(global::CharReference.RefObjKey.H_Kokan);
		if (referenceInfo == null)
		{
			return false;
		}
		this.maleBody.sonRotDeltaTime += _fDelta;
		if (this.maleBody.sonRotDeltaTime >= this.maleBody.sonRotTime)
		{
			this.maleBody.sonRotDeltaTime = this.maleBody.sonRotTime;
		}
		float t = 1f;
		if (this.maleBody.sonRotTime != 0f)
		{
			t = this.maleBody.sonRotDeltaTime / this.maleBody.sonRotTime;
		}
		referenceInfo.transform.rotation = Quaternion.Slerp(referenceInfo.transform.rotation, _qLook, t);
		return true;
	}

	// Token: 0x060010F3 RID: 4339 RVA: 0x0007A410 File Offset: 0x00078610
	public virtual void ChangeSimpleBodyDraw(bool drawSimple)
	{
		this.maleStatusInfo.visibleSimple = drawSimple;
	}

	// Token: 0x060010F4 RID: 4340 RVA: 0x0007A420 File Offset: 0x00078620
	public virtual void ChangeSimpleBodyColor(Color color)
	{
		this.maleStatusInfo.simpleColor = color;
		if (this.maleBody.smrSimpleBody)
		{
			Material material = this.maleBody.smrSimpleBody.material;
			if (material)
			{
				material.SetColor(global::Singleton<Manager.Character>.Instance._Color, color);
			}
		}
		if (this.maleBody.smrSimpleHand)
		{
			Material material2 = this.maleBody.smrSimpleHand.material;
			if (material2)
			{
				material2.SetColor(global::Singleton<Manager.Character>.Instance._Color, color);
			}
		}
		if (this.maleBody.smrSimpleTongue)
		{
			Material material3 = this.maleBody.smrSimpleTongue.material;
			if (material3)
			{
				material3.SetColor(global::Singleton<Manager.Character>.Instance._Color, color);
			}
		}
	}

	// Token: 0x060010F5 RID: 4341 RVA: 0x0007A500 File Offset: 0x00078700
	public virtual void StartSavePlayerFile()
	{
		this.backupCharaFileBytes = base.chaFile.charaFilePNG;
		string assetBundleName = "custom/custom_etc.unity3d";
		TextAsset textAsset = global::CommonLib.LoadAsset<TextAsset>(assetBundleName, "player_silhouette", false, string.Empty);
		global::AssetBundleManager.UnloadAssetBundle(assetBundleName, true, null);
		base.chaFile.charaFilePNG = textAsset.bytes;
	}

	// Token: 0x060010F6 RID: 4342 RVA: 0x0007A550 File Offset: 0x00078750
	public virtual void EndSavePlayerFile()
	{
		base.chaFile.charaFilePNG = this.backupCharaFileBytes;
		this.backupCharaFileBytes = null;
		Resources.UnloadUnusedAssets();
	}

	// Token: 0x040012AB RID: 4779
	public byte[] backupCharaFileBytes;
}
